package com.tanhua.server.controller;

import cn.hutool.core.util.ObjectUtil;
import com.tanhua.server.service.SubmitQuestionnaireService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/testSoul")
@Slf4j
public class SubmitQuestionnaireController {

    @Autowired
    private SubmitQuestionnaireService questionSoulService;

    @PostMapping
    public String testSou(@RequestBody Map<String, Object> param){

        try {
            String result  =  questionSoulService.getResult(param);
            if (ObjectUtil.isNotEmpty(result)){
                return result;
            }
        } catch (Exception e) {
            log.error("问卷提交失败", e);
        }
        return null;
    }

}